from selenium.webdriver.common.by import By

from data.login_pre.basePage import BasePage


# 登录页面类
class LoginPage(BasePage):
    # 登录页面
    url = '/UAMS/login?order=3'
    # 用户名
    username = (By.NAME, 'username')
    # 密码
    password = (By.ID, 'password1')
    # 登录按钮
    submit = (By.CLASS_NAME, 'submitButton')

    # 登录操作
    def login(self, user_name, pass_word):
        # 打开登录页面
        self.base_open_url(self.url)
        # 输入用户名
        self.base_send_keys(self.username, user_name)
        # 输入密码
        self.base_send_keys(self.password, pass_word)
        # 点击登录按钮
        self.base_click(self.submit)
